<template>
  <div class="progress-my">
    <div class="titleLine">
      <div class="title">{{ title }}</div>
      <div class="num" v-if="num !== undefined && num !== null">{{ num }}kWh</div>
    </div>
    <div v-if="showProgress" class="wrapper">
      <div class="progress" :style="{ width: `${percent}%` }"></div>
    </div>
  </div>
</template>

<script setup>
const props = defineProps(["data"]);
const { title, num, percent, showProgress = true } = props.data;
</script>

<style lang="scss" scoped>
.progress-my {
  display: flex;
  flex-direction: column;

  .titleLine {
    width: 100%;
    display: flex;
    justify-content: space-between;

    .title {
      width: 100%;
      font-size: 13px;
      color: #6D7171;
      text-overflow: ellipsis;
      overflow: hidden;
      // white-space: nowrap;
    }

    .num {
      font-size: 14px;
      color: #1A1A2A;
    }
  }

  .wrapper {
    margin-top: 4px;
    width: 100%;
    border-radius: 2px;
    height: 4px;
    background-color: #EBF0EF;

    .progress {
      height: 4px;
      border-radius: 2px;
      background-color: #04A17E;
    }
  }
}
</style>